package com.fyj.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fyj.utils.JdbcUtils;
import com.fyj.utils.ThreadUtil;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.*;

/**
 * @author 钰杰
 * @className User
 * @description VX:FengYJ996
 * @date 2019/11/3018:33
 */
@Entity
@Data
@Table(name = "tb_user")
public class User implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    private Integer userid;     //用户编号
    private String username;    //用户姓名
    private String password;    //密码
    private int status;         //用户状态
    private int roleid;         //角色编号

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date lastLogin;     //最后登录时间

//    public static void main(String[] args) {
//        //源数据库
//        Map map = new HashMap();
//        map.put("driver", "com.mysql.jdbc.Driver");
//        map.put("url", "jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC");
//        map.put("username", "root");
//        map.put("password", "123");
//
//        List<String> arrayList = new ArrayList<>();
//        String sql = null;
//        for (int j = 1; j <= 2000000; j++) {
//            sql = "INSERT INTO `test`.`goods` (`id`, `goods_name`, `goods_title`, `goods_img`, `goods_detail`, `goods_price`, `goods_stock`) VALUES ('" + i + "', '华为Meta 10', '华为Meta 10(A1865 64G 黑色 全网通 4G手机)', 'img/meta10.png', '华为Meta 10(A1865 64G 黑色 全网通 4G手机)', '3300.00', '1000')";
//            arrayList.add(sql);
//        }
//
//        System.out.println("添加数据大小为：" + arrayList.size());
//        try {
//            for (int i = 1; i <= 25; i++) {
//                List<String> stringList = ThreadUtil.AllocationThread(map, 20000000, arrayList, 25);
//                new Thread(new ThreadUtil(map, stringList)).start();
//            }
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//    }


}
